import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import vueDevTools from "vite-plugin-vue-devtools";
import unoCss from "unocss/vite";
import { presetAttributify, presetUno } from "unocss"; // Presets
// import monaco from '@tomjs/vite-plugin-monaco-editor';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    vueDevTools(),
    unoCss({
      presets: [presetAttributify(), presetUno()] // Presets
    })
    // monaco(),
  ],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url))
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        api: "modern-compiler" // or "modern"
      }
    }
  },
  server: {
    proxy: {
      "/api": {
        target: "http://127.0.0.1:8899",
        changeOrigin: true
        // rewrite: (path) => path.replace(/^\/api/, ""),
      }
    }
  }
});
